import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:untitled1/app/broker/modules/employer/EmployerRecordPage.dart';
import 'package:untitled1/app/res/myColors.dart';
import 'package:untitled1/app/utils/utilRouter.dart';
import 'package:untitled1/app/widgets/TitleBar.dart';
import 'package:untitled1/app/widgets/dialog/MyConfirmCancelDialog.dart';

import '../../../widgets/MyGrid.dart';
import '../../../widgets/TextSelector.dart';
import '../../../widgets/base_page/BaseStatefulPage.dart';
import '../Test.dart';
import 'EmployerDetailUpdate.dart';
import 'employer_page/RefundDialogPage.dart';
import 'employer_page/employer_page_dialog/CountdownTextSplit.dart';

class EmployerDetailPage extends BaseStatefulPage {
  @override
  BaseStatefulPageState<BaseStatefulPage> createState() {
    return _EmployerDetailPageState();
  }
}

class _EmployerDetailPageState
    extends BaseStatefulPageState<EmployerDetailPage> {
  final ScrollController _scrollController = ScrollController();
  final List<GlobalKey> _titles = [GlobalKey(debugLabel: 'qwsq'), GlobalKey(debugLabel:'jbxx'),GlobalKey(debugLabel:'gwxx'),GlobalKey(debugLabel:'jjrpl')];
  void scrollTo(GlobalKey key) {
    final context = key.currentContext;
    if (context != null) {
      Scrollable.ensureVisible(
        context,
        duration: const Duration(milliseconds: 500),
        alignment: 0.0, // 0.0 表示滚动到顶部
        curve: Curves.easeInOut,
      );
    }
  }


  @override
  Widget buildPage(BuildContext context) {
    return Scaffold(
      appBar: TitleBar(title: "雇主详情"),
      body: Container(
        decoration: BoxDecoration(
          image: DecorationImage(
            image: AssetImage('assets/app/guzhu_bg.png'),
            fit: BoxFit.cover, // 设置图片填充方式
            alignment: Alignment.center, // 设置图片的位置
          ),
        ),
        child: Column(
          children: [
            TextSelector(
              options: ['期望诉求', '基本信息', '过往信息', '经纪人评论'],
              onTap: (index) {
                print(">]index=${index}");
                WidgetsBinding.instance.addPostFrameCallback((_) {
                  scrollTo(_titles[index]);
                });
              },
            ),
            Expanded(
              child: Stack(
                children: [
                  SingleChildScrollView(
                    controller: _scrollController,
                    child: Column(
                      key:_titles[0],
                      children: [
                        SizedBox(height: 10),
                        Container(
                          margin: EdgeInsets.only(left: 15, right: 15),
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Row(
                                children: [
                                  Image.asset(
                                    'assets/app/laiyuan.png',
                                    height: 20,
                                    width: 20,
                                  ),
                                  SizedBox(width: 5),
                                  Text(
                                    "来源于平台线下 ｜ C端",
                                    style: TextStyle(
                                      fontSize: 14,
                                      fontWeight: FontWeight.bold,
                                      color: Colors.white,
                                    ),
                                  ),
                                ],
                              ),
                              Text(
                                '意向度 S',
                                style: TextStyle(
                                  fontSize: 14,
                                  fontWeight: FontWeight.bold,
                                  color: Colors.white,
                                ),
                              ),
                            ],
                          ),
                        ),
                        Container(
                          width: MediaQuery.of(context).size.width,
                          margin: EdgeInsets.only(left: 10, right: 10, top: 10),
                          decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.circular(5),
                          ),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Container(
                                alignment: Alignment.centerRight,
                                child: Container(
                                  padding: EdgeInsets.all(3),
                                  decoration: BoxDecoration(
                                    color: Color(0xFFDFBF973D),
                                    borderRadius: BorderRadius.only(
                                      topRight: Radius.circular(5),
                                      bottomLeft: Radius.circular(5),
                                    ),
                                  ),
                                  child: Text(
                                    '发起定金合同',
                                    style: TextStyle(
                                      color: Color(0xff947031B2),
                                      fontSize: 14,
                                    ),
                                  ),
                                ),
                              ),
                              Container(
                                margin: EdgeInsets.only(left: 10, right: 10),
                                child: Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                  children: [
                                    Column(
                                      crossAxisAlignment: CrossAxisAlignment.start,
                                      children: [
                                        Text(
                                          '家员私厨',
                                          style: TextStyle(
                                            fontSize: 16,
                                            fontWeight: FontWeight.bold,
                                            color: Colors.black,
                                          ),
                                        ),
                                        SizedBox(height: 5),
                                        Text(
                                          '5%保姆/保洁',
                                          style: TextStyle(
                                            fontSize: 12,
                                            color: Colors.black,
                                          ),
                                        ),
                                      ],
                                    ),
                                    Container(
                                      alignment: Alignment.centerRight,
                                      child: Text(
                                        '10000-20000/时薪',
                                        style: TextStyle(
                                          fontSize: 16,
                                          fontWeight: FontWeight.bold,
                                          color: Color(0xFFB51C21),
                                        ),
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                              SizedBox(height: 5),
                              Container(
                                margin: EdgeInsets.only(left: 10, right: 10),
                                child: Text(
                                  '住家｜8-20点 24小时',
                                  style: TextStyle(
                                    fontSize: 12,
                                    color: Colors.black,
                                  ),
                                ),
                              ),
                              SizedBox(height: 5),
                              Divider(
                                height: 1,
                                thickness: 1,
                                indent: 10,
                                endIndent: 10,
                              ),
                              SizedBox(height: 5),
                              Row(
                                children: [
                                  SizedBox(width: 10),
                                  Image.asset(
                                    'assets/app/home_dw.png',
                                    height: 20,
                                    width: 20,
                                  ),
                                  Text("xxx省xxx城市"),
                                ],
                              ),
                              SizedBox(height: 20),
                              Container(
                                height: 30,
                                width: 120,
                                padding: EdgeInsets.only(left: 10),
                                alignment: Alignment.centerLeft,
                                decoration: BoxDecoration(
                                  color: myColors.red,
                                  image: DecorationImage(
                                    image: AssetImage('assets/app/biaoti.png'),
                                    fit: BoxFit.cover,
                                    alignment: Alignment.center,
                                  ),
                                ),
                                child: Text(
                                  "工作内容",
                                  style: TextStyle(
                                    color: myColors.c_191919,
                                    fontSize: 15,
                                    fontWeight: FontWeight.bold,
                                  ),
                                ),
                              ),
                              SizedBox(height: 5),
                              Container(
                                margin: EdgeInsets.only(left: 10, right: 10),
                                child: Text(
                                  "主要工作: 接孩子, 家庭五口一日三餐、整理房间清洁房间、开车接孩子上下学,剩下就是产品文档了。接孩子、家庭五口一日三餐、整理房间、清洁房间、开车剩下就是产品文档了",
                                  style: TextStyle(
                                    fontSize: 14,
                                    color: myColors.c_707070,
                                  ),
                                ),
                              ),
                              SizedBox(height: 5),
                              Container(
                                margin: EdgeInsets.only(left: 10, right: 10),
                                child: Text(
                                  "辅助工作: 偶尔帮助雇主照看老人、陪伴老人",
                                  style: TextStyle(
                                    fontSize: 14,
                                    color: myColors.c_707070,
                                  ),
                                ),
                              ),
                              SizedBox(height: 10),
                              Container(
                                height: 30,
                                width: 120,
                                padding: EdgeInsets.only(left: 10),
                                alignment: Alignment.centerLeft,
                                decoration: BoxDecoration(
                                  color: myColors.red,
                                  image: DecorationImage(
                                    image: AssetImage('assets/app/biaoti.png'),
                                    fit: BoxFit.cover,
                                    alignment: Alignment.center,
                                  ),
                                ),
                                child: Text(
                                  "时间范围",
                                  style: TextStyle(
                                    color: myColors.c_191919,
                                    fontSize: 15,
                                    fontWeight: FontWeight.bold,
                                  ),
                                ),
                              ),
                              SizedBox(height: 5),
                              Container(
                                margin: EdgeInsets.only(left: 10, right: 10),
                                child: Text(
                                  "面试时间: 2025.07.02",
                                  style: TextStyle(
                                    fontSize: 14,
                                    color: myColors.c_707070,
                                  ),
                                ),
                              ),
                              SizedBox(height: 5),
                              Container(
                                margin: EdgeInsets.only(left: 10, right: 10),
                                child: Text(
                                  "入户时间: 2025.07.15",
                                  style: TextStyle(
                                    fontSize: 14,
                                    color: myColors.c_707070,
                                  ),
                                ),
                              ),
                              SizedBox(height: 10),
                              Container(
                                height: 30,
                                width: 120,
                                alignment: Alignment.centerLeft,
                                padding: EdgeInsets.only(left: 10),
                                decoration: BoxDecoration(
                                  color: myColors.red,
                                  image: DecorationImage(
                                    image: AssetImage('assets/app/biaoti.png'),
                                    fit: BoxFit.cover,
                                    alignment: Alignment.center,
                                  ),
                                ),
                                child: Text(
                                  "福利",
                                  style: TextStyle(
                                    color: myColors.c_191919,
                                    fontSize: 15,
                                    fontWeight: FontWeight.bold,
                                  ),
                                ),
                              ),
                              SizedBox(height: 5),
                              Container(
                                margin: EdgeInsets.only(left: 10, right: 10),
                                child: MyGrid(
                                  children: List.generate(
                                    10, (index) => Container(
                                    height: 20,
                                    alignment: Alignment.center,
                                    decoration: BoxDecoration(
                                      borderRadius: BorderRadius.circular(3),
                                      color: Color(0xffF4F5F6),
                                    ),

                                    child: Text('Item $index', style: TextStyle(color: myColors.c_191919)),
                                  ),
                                  ),
                                  columnCount: 4, // 每行 4 列
                                ),
                              ),
                              SizedBox(height: 10),
                              Container(
                                margin: EdgeInsets.only(left: 10, right: 10),
                                child: Text("这里是雇主后台撰写的可以承诺给家政人员的福利，有的是文字比较多的情况下应该展示的样式，剩下的给产品经理了。"
                                    , style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                              ),
                              SizedBox(height: 10),
                              Container(
                                height: 30,
                                width: 120,
                                alignment: Alignment.centerLeft,
                                padding: EdgeInsets.only(left: 10),
                                decoration: BoxDecoration(
                                  color: myColors.red,
                                  image: DecorationImage(
                                    image: AssetImage('assets/app/biaoti.png'),
                                    fit: BoxFit.cover,
                                    alignment: Alignment.center,
                                  ),
                                ),
                                child: Text(
                                  "其他诉求",
                                  style: TextStyle(
                                    color: myColors.c_191919,
                                    fontSize: 15,
                                    fontWeight: FontWeight.bold,
                                  ),
                                ),
                              ),
                              SizedBox(height: 5),
                              Container(
                                padding: EdgeInsets.only(left: 10, right: 10),
                                child: Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Text("服务100以上位雇主｜5-10年经验" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("性别要求: 男" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("年龄要求: 36-40" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("意向籍贯: 山西、山东、河北" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("其他技能: 会开车" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("禁忌内容: 有前科、有纹身" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("语言: 英语、普通话" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("星座: 双鱼座、天蝎座、摩羯座" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("属相: 牛、龙、虎" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("民族: 不限" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("宗教信仰: 无" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                  ],
                                ),
                              )
                            ],
                          ),
                        ),
                        SizedBox(height: 10),
                        Container(
                          key:  _titles[1],
                          width: MediaQuery.of(context).size.width,
                          margin: EdgeInsets.only(left: 15, right: 15),
                          padding: EdgeInsets.only(bottom: 10, top: 10),
                          decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.circular(5),
                          ),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Container(
                                height: 30,
                                width: 120,
                                alignment: Alignment.centerLeft,
                                padding: EdgeInsets.only(left: 10),
                                decoration: BoxDecoration(
                                  color: myColors.red,
                                  image: DecorationImage(
                                    image: AssetImage('assets/app/biaoti.png'),
                                    fit: BoxFit.cover,
                                    alignment: Alignment.center,
                                  ),
                                ),
                                child: Text(
                                  "基本信息",
                                  style: TextStyle(
                                    color: myColors.c_191919,
                                    fontSize: 15,
                                    fontWeight: FontWeight.bold,
                                  ),
                                ),
                              ),
                              SizedBox(height: 5),
                              Row(
                                children: [
                                  SizedBox(width: 10,),
                                  Text("张先生",style: TextStyle(fontSize: 16,fontWeight:FontWeight.bold,color: myColors.c_191919 ),),
                                  SizedBox(width: 10,),
                                  Text("广东人 | 37 | 男 | 狗 | 双鱼座 | 汉族",style: TextStyle(fontSize: 14,color: myColors.c_707070 ),),
                                ],
                              ),
                              SizedBox(height: 5),
                              Container(
                                padding: EdgeInsets.only(left: 10, right: 10),
                                child: Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Text("居住地址: 北京市西城区" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("庭情况: 干净整洁的原生家庭、5口人" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("婚姻情况: 已婚已育" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("老人情况: 两位老人、70岁左右" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("子女情况: 一个男孩，上初三" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                    Text("宠物情况: 有一只金毛犬" ,style: TextStyle(fontSize: 14, color: myColors.c_707070)),
                                  ],
                                ),
                              )
                            ],
                          ),
                        ),
                        SizedBox(height: 10),
                        Container(
                          key: _titles[2],
                          width: MediaQuery.of(context).size.width,
                          margin: EdgeInsets.only(left: 15, right: 15),
                          padding: EdgeInsets.only(bottom: 10, top: 10),
                          decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.circular(5),
                          ),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Container(
                                height: 30,
                                width: 120,
                                alignment: Alignment.centerLeft,
                                padding: EdgeInsets.only(left: 10),
                                decoration: BoxDecoration(
                                  color: myColors.red,
                                  image: DecorationImage(
                                    image: AssetImage('assets/app/biaoti.png'),
                                    fit: BoxFit.cover,
                                    alignment: Alignment.center,
                                  ),
                                ),
                                child: Text(
                                  "过往信息",
                                  style: TextStyle(
                                    color: myColors.c_191919,
                                    fontSize: 15,
                                    fontWeight: FontWeight.bold,
                                  ),
                                ),
                              ),
                              SizedBox(height: 10),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Row(
                                    children: [
                                      SizedBox(width: 10,),
                                      Image.asset("assets/app/q1.png",height: 30,width: 30,),
                                      Text('曾聘请过几位服务人员：',style: TextStyle(fontSize: 14,color: myColors.c_707070),),
                                    ],
                                  ),
                                  SizedBox(width: 5,),
                                  Container(
                                    width: MediaQuery.of(context).size.width,
                                    height: 30,
                                    alignment: Alignment.centerLeft,
                                    margin: EdgeInsets.only(left: 10,right: 10),
                                    padding: EdgeInsets.only(left: 10),
                                    decoration: BoxDecoration(
                                      color: Color(0xffFFF7F7),
                                      borderRadius: BorderRadius.circular(5),
                                      border: Border.all(
                                        color: Color(0xffFFB7B9),
                                        width: 1,
                                      ),
                                    ),
                                    child: Text("A:3位",style: TextStyle(fontSize: 14,color: myColors.c_707070),),
                                  )
                                ],
                              ),
                              SizedBox(height: 10),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Row(
                                    children: [
                                      SizedBox(width: 10,),
                                      Image.asset("assets/app/q2.png",height: 30,width: 30,),
                                      Text('您认可的服务人员在哪方面最吸引您：',style: TextStyle(fontSize: 14,color: myColors.c_707070),),
                                    ],
                                  ),
                                  SizedBox(width: 5,),
                                  Container(
                                    width: MediaQuery.of(context).size.width,
                                    height: 30,
                                    alignment: Alignment.centerLeft,
                                    margin: EdgeInsets.only(left: 10,right: 10),
                                    padding: EdgeInsets.only(left: 10),
                                    decoration: BoxDecoration(
                                      color: Color(0xffFFF7F7),
                                      borderRadius: BorderRadius.circular(5),
                                      border: Border.all(
                                        color: Color(0xffFFB7B9),
                                        width: 1,
                                      ),
                                    ),
                                    child: Text("A:3位",style: TextStyle(fontSize: 14,color: myColors.c_707070),),
                                  )
                                ],
                              ),
                              SizedBox(height: 10),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Row(
                                    children: [
                                      SizedBox(width: 10,),
                                      Image.asset("assets/app/q3.png",height: 30,width: 30,),
                                      Text('与前任服务人员解除合作的原因是什么：',style: TextStyle(fontSize: 14,color: myColors.c_707070),),
                                    ],
                                  ),
                                  SizedBox(width: 5,),
                                  Container(
                                    width: MediaQuery.of(context).size.width,
                                    height: 30,
                                    alignment: Alignment.centerLeft,
                                    margin: EdgeInsets.only(left: 10,right: 10),
                                    padding: EdgeInsets.only(left: 10),
                                    decoration: BoxDecoration(
                                      color: Color(0xffFFF7F7),
                                      borderRadius: BorderRadius.circular(5),
                                      border: Border.all(
                                        color: Color(0xffFFB7B9),
                                        width: 1,
                                      ),
                                    ),
                                    child: Text("A:3位",style: TextStyle(fontSize: 14,color: myColors.c_707070),),
                                  )
                                ],
                              ),
                              SizedBox(height: 10),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Row(
                                    children: [
                                      SizedBox(width: 10,),
                                      Image.asset("assets/app/q4.png",height: 30,width: 30,),
                                      Text('分别在哪个企业机构聘请的服务人员：',style: TextStyle(fontSize: 14,color: myColors.c_707070),),
                                    ],
                                  ),
                                  SizedBox(width: 5,),
                                  Container(
                                    width: MediaQuery.of(context).size.width,
                                    height: 30,
                                    alignment: Alignment.centerLeft,
                                    margin: EdgeInsets.only(left: 10,right: 10),
                                    padding: EdgeInsets.only(left: 10),
                                    decoration: BoxDecoration(
                                      color: Color(0xffFFF7F7),
                                      borderRadius: BorderRadius.circular(5),
                                      border: Border.all(
                                        color: Color(0xffFFB7B9),
                                        width: 1,
                                      ),
                                    ),
                                    child: Text("A:3位",style: TextStyle(fontSize: 14,color: myColors.c_707070),),
                                  )
                                ],
                              ),
                              SizedBox(height: 10),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Row(
                                    children: [
                                      SizedBox(width: 10,),
                                      Image.asset("assets/app/q5.png",height: 30,width: 30,),
                                      Text('您最忌讳服务人员的哪些行为：',style: TextStyle(fontSize: 14,color: myColors.c_707070),),
                                    ],
                                  ),
                                  SizedBox(width: 5,),
                                  Container(
                                    width: MediaQuery.of(context).size.width,
                                    height: 30,
                                    alignment: Alignment.centerLeft,
                                    margin: EdgeInsets.only(left: 10,right: 10),
                                    padding: EdgeInsets.only(left: 10),
                                    decoration: BoxDecoration(
                                      color: Color(0xffFFF7F7),
                                      borderRadius: BorderRadius.circular(5),
                                      border: Border.all(
                                        color: Color(0xffFFB7B9),
                                        width: 1,
                                      ),
                                    ),
                                    child: Text("A:3位",style: TextStyle(fontSize: 14,color: myColors.c_707070),),
                                  )
                                ],
                              ),
                            ],
                          ),
                        ),
                        SizedBox(height: 10),
                        Container(
                          key: _titles[3],
                          width: MediaQuery.of(context).size.width,
                          margin: EdgeInsets.only(left: 15, right: 15),
                          padding: EdgeInsets.only(bottom: 10, top: 10),
                          decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.circular(5),
                          ),
                          child: Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                Container(
                                  height: 30,
                                  width: 120,
                                  alignment: Alignment.centerLeft,
                                  padding: EdgeInsets.only(left: 10),
                                  decoration: BoxDecoration(
                                    color: myColors.red,
                                    image: DecorationImage(
                                      image: AssetImage('assets/app/biaoti.png'),
                                      fit: BoxFit.cover,
                                      alignment: Alignment.center,
                                    ),
                                  ),
                                  child: Text(
                                    "经纪人评价",
                                    style: TextStyle(
                                      color: myColors.c_191919,
                                      fontSize: 15,
                                      fontWeight: FontWeight.bold,
                                    ),
                                  ),
                                ),
                                SizedBox(height: 10),
                                Container(
                                  padding: EdgeInsets.only(left: 10,right: 10),
                                  child:Text('服务百岁老人真的福气呀，而且老人很喜欢现有白班阿姨，待人亲和、乐观，但新阿姨入府需要有耐心才好被老人认可;XXXXXXXXX整体劳务内容与报酬不错;',
                                    style: TextStyle(fontSize: 14,color: myColors.c_707070),),
                                )
                              ]
                          ),
                        ),
                        SizedBox(height: 100,)
                      ],
                    ),
                  ),
                  Positioned(
                    left:0 ,
                    right: 0,
                    bottom: 0,
                    child: getFootBox(),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }

  Widget getFootBox(){
    return Container(
      width: MediaQuery.of(context).size.width,
      color: myColors.white,
      child: Column(
        children: [
          // Text('aaaa'),
          Container(
            width: MediaQuery.of(context).size.width,
            decoration: BoxDecoration(
              image: DecorationImage(
                image: AssetImage('assets/app/zhuangtai_bg2.png'),
                fit: BoxFit.fill,
              ),
            ),
            height: 30,
            child: Container(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text('订单还剩', style: TextStyle(color: myColors.white)),
                  CountdownTextSplit(timeStr: "23:59:59"),
                  // SizedBox(width: 10),
                  // CountdownTextSplit(timeStr: "8天:23:59:59"),
                ],
              ),
            ),
          ),
          Container(
            color: myColors.white,
            padding: EdgeInsets.only(top: 10, bottom: 10),
            child: Row(
              mainAxisSize: MainAxisSize.max,
              children: [
                // 左侧按钮们：退单、记录、待分享、完善信息、打电话
                Row(
                  children:getFootTexts(),
                ),

                // 右侧按钮们
                Expanded(
                  child: Row(//aaa
                    mainAxisSize: MainAxisSize.max,
                    children: getFootButtons(),
                  ),
                ),
              ],
            ),
          )
        ],
      ),
    );
  }

  List<Widget> getFootTexts(){
    if(1==1){
      return [
        _buildSimpleButton('退单','tuidan'),
        _buildSimpleButton('记录','服务记录'),
        // _buildSimpleButton('待分享'),
        _buildSimpleButton('完善信息','wsxx'),
        // _buildOutlinedButton('打电话'),
      ];
    }
    return [];
  }
  List<Widget> getFootButtons(){
    if(1==1){
      return [
        // Expanded(flex:1,child: _buildVerticalButton('服务费尾款', '待支付')),
        // Expanded(flex:1, child:_buildSolidButton('代收薪资')),
      ];
      //
      // _buildSolidButton('接单'),
      // _buildSolidButton('发起委托协议'),
      // _buildVerticalButton('委托协议', '待签署'),
      // _buildSolidButton('发起定金合同'),

      //Expanded(child:   _buildVerticalButton('定金合同', '待签署'))
    // _buildSolidButton('缴纳定金'),
    // _buildVerticalButton('缴纳定金', '待支付'),
    // _buildSolidButton('发起合作合同'),
    // _buildVerticalButton('合作合同', '待签署'),
    // _buildVerticalButton('服务费尾款', '待支付'),
    // _buildSolidButton('代收薪资'),
    // _buildVerticalButton('代收薪资', '待支付'),
    // _buildVerticalButton('代收薪资', '本期付清'),
    }else if(1==2){

    }
    return [];
  }

  // 左侧通用短按钮
  Widget _buildSimpleButton(String text,String type) {
    return GestureDetector(
      onTap: () {
        if('wsxx'==type){
          utilRouter.to(EmployerDetailUpdate());
        }else if('tuidan'== type){
          // EmployerPageDialog.dialog_Chargeback(context, (data) {
          //   Navigator.pop(context);
          // });
          // Navigator.of(context).push(
          //   MaterialPageRoute(builder: (_) => RefundDialogPage(), fullscreenDialog: true),
          // );
          showDialog(
            context: context,
            barrierDismissible: false, // 点击空白区域不关闭
            builder: (context) {
              return Dialog(
                insetPadding: EdgeInsets.zero, // 去除默认 margin
                backgroundColor: Colors.transparent, // 让背景透明（我们内容自己决定样式）
                child: RefundDialogPage(), // 就是你的弹出框内容
              );
            },
          );
        }else if('服务记录'==type){
          utilRouter.to(EmployerRecordPage());
          // showDialog(
          //   context: context,
          //   barrierDismissible: false, // 点击空白区域不关闭
          //   builder: (context) {
          //     return Dialog(
          //       insetPadding: EdgeInsets.zero, // 去除默认 margin
          //       backgroundColor: Colors.transparent, // 让背景透明（我们内容自己决定样式）
          //       child: ServerRecordDialog(), // 就是你的弹出框内容
          //     );
          //   },
          // );
        }
      },
      child: Container(
        width: 60,
        height: 40,
        alignment: Alignment.center,
        margin: const EdgeInsets.only(right: 6),
        child: Text(
          text,
          style: const TextStyle(fontSize: 14, color: Color(0xFF191919)),
        ),
      ),
    );
  }

  // 左侧：打电话按钮（红色边框）
  Widget _buildOutlinedButton(String text) {
    return Container(
      width: 70,
      height: 40,
      alignment: Alignment.center,
      margin: const EdgeInsets.only(left: 6),
      decoration: BoxDecoration(
        color: const Color(0xFFFFF9F9),
        border: Border.all(color: Color(0xFFFF4142)),
        borderRadius: BorderRadius.circular(50),
      ),
      child: Text(
        text,
        style: const TextStyle(
          fontSize: 14,
          fontWeight: FontWeight.bold,
          color: Color(0xFFFF4142),
        ),
      ),
    );
  }

  // 右侧：单行红底白字按钮
  Widget _buildSolidButton(String text) {
    return Container(
      width: 80,
      height: 40,
      alignment: Alignment.center,
      margin: const EdgeInsets.only(left: 8),
      decoration: BoxDecoration(
        color: const Color(0xFFFF4142),
        border: Border.all(color: Color(0xFFFF4142)),
        borderRadius: BorderRadius.circular(50),
      ),
      child: Text(
        text,
        style: const TextStyle(
          fontSize: 14,
          fontWeight: FontWeight.bold,
          color: Colors.white,
        ),
      ),
    );
  }

  // 右侧：两行按钮（标题 + 状态）
  Widget _buildVerticalButton(String title, String status) {
    return Container(
      width: 80,
      height: 40,
      margin: const EdgeInsets.only(left: 8),
      decoration: BoxDecoration(
        color: const Color(0xFFFF4142),
        border: Border.all(color: Color(0xFFFF4142)),
        borderRadius: BorderRadius.circular(50),
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Text(
            title,
            style: const TextStyle(
              fontSize: 12,
              fontWeight: FontWeight.bold,
              color: Colors.white,
            ),
          ),
          Text(
            status,
            style: const TextStyle(
              fontSize: 12,
              fontWeight: FontWeight.normal,
              color: Colors.white,
            ),
          ),
        ],
      ),
    );
  }
}
